home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7729 < prev    next >
Mailbox/MIME Entity  |  1996-08-05  |  6.6 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Mailbox/MIME Entity (archive/mbox).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert Mailbox/MIME Entity (archive/mbox) magic Supported
100% dexvert Internet Message Format (text/imf) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news, ASCII text default
100% checkBytes Printable ASCII default
100% dexmagic PrintFox/Pagefox WEAK default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/950 MIME Email (1.0) default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/news default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 61 74 68 3a 20 6e 65 | 77 73 2e 6a 68 75 2e 65 |Path: ne|ws.jhu.e|
|00000010| 64 75 21 6e 65 77 73 0a | 46 72 6f 6d 3a 20 43 68 |du!news.|From: Ch|
|00000020| 65 6e 79 61 6e 67 20 58 | 75 20 3c 63 68 65 6e 79 |enyang X|u <cheny|
|00000030| 61 6e 67 40 6d 61 73 68 | 69 65 2e 65 63 65 2e 6a |ang@mash|ie.ece.j|
|00000040| 68 75 2e 65 64 75 3e 0a | 4e 65 77 73 67 72 6f 75 |hu.edu>.|Newsgrou|
|00000050| 70 73 3a 20 63 6f 6d 70 | 2e 6c 61 6e 67 2e 63 0a |ps: comp|.lang.c.|
|00000060| 53 75 62 6a 65 63 74 3a | 20 52 65 3a 20 6d 61 6c |Subject:| Re: mal|
|00000070| 6c 6f 63 28 29 0a 44 61 | 74 65 3a 20 57 65 64 2c |loc().Da|te: Wed,|
|00000080| 20 32 38 20 46 65 62 20 | 31 39 39 36 20 31 30 3a | 28 Feb |1996 10:|
|00000090| 30 34 3a 35 30 20 2d 30 | 35 30 30 0a 4f 72 67 61 |04:50 -0|500.Orga|
|000000a0| 6e 69 7a 61 74 69 6f 6e | 3a 20 45 43 45 20 44 65 |nization|: ECE De|
|000000b0| 70 61 72 74 6d 65 6e 74 | 2c 20 54 68 65 20 4a 6f |partment|, The Jo|
|000000c0| 68 6e 73 20 48 6f 70 6b | 69 6e 73 20 55 6e 69 76 |hns Hopk|ins Univ|
|000000d0| 65 72 73 69 74 79 0a 4d | 65 73 73 61 67 65 2d 49 |ersity.M|essage-I|
|000000e0| 44 3a 20 3c 33 31 33 34 | 36 46 31 32 2e 31 36 37 |D: <3134|6F12.167|
|000000f0| 45 40 6d 61 73 68 69 65 | 2e 65 63 65 2e 6a 68 75 |E@mashie|.ece.jhu|
|00000100| 2e 65 64 75 3e 0a 4e 4e | 54 50 2d 50 6f 73 74 69 |.edu>.NN|TP-Posti|
|00000110| 6e 67 2d 48 6f 73 74 3a | 20 31 32 38 2e 32 32 30 |ng-Host:| 128.220|
|00000120| 2e 31 34 2e 32 36 0a 4d | 69 6d 65 2d 56 65 72 73 |.14.26.M|ime-Vers|
|00000130| 69 6f 6e 3a 20 31 2e 30 | 0a 43 6f 6e 74 65 6e 74 |ion: 1.0|.Content|
|00000140| 2d 54 79 70 65 3a 20 74 | 65 78 74 2f 70 6c 61 69 |-Type: t|ext/plai|
|00000150| 6e 3b 20 63 68 61 72 73 | 65 74 3d 75 73 2d 61 73 |n; chars|et=us-as|
|00000160| 63 69 69 0a 43 6f 6e 74 | 65 6e 74 2d 54 72 61 6e |cii.Cont|ent-Tran|
|00000170| 73 66 65 72 2d 45 6e 63 | 6f 64 69 6e 67 3a 20 37 |sfer-Enc|oding: 7|
|00000180| 62 69 74 0a 58 2d 4d 61 | 69 6c 65 72 3a 20 4d 6f |bit.X-Ma|iler: Mo|
|00000190| 7a 69 6c 6c 61 20 32 2e | 30 20 28 58 31 31 3b 20 |zilla 2.|0 (X11; |
|000001a0| 49 3b 20 49 52 49 58 20 | 35 2e 32 20 49 50 32 32 |I; IRIX |5.2 IP22|
|000001b0| 29 0a 0a 48 69 2c 20 74 | 68 65 72 65 2c 0a 0a 20 |)..Hi, t|here,.. |
|000001c0| 20 20 20 49 20 70 6f 73 | 74 65 64 20 61 20 71 75 | I pos|ted a qu|
|000001d0| 65 73 74 69 6f 6e 20 61 | 62 6f 75 74 20 64 65 62 |estion a|bout deb|
|000001e0| 75 67 67 69 6e 67 20 70 | 72 6f 62 6c 65 6d 73 20 |ugging p|roblems |
|000001f0| 72 65 6c 61 74 65 64 20 | 74 6f 20 6d 61 6c 6c 6f |related |to mallo|
|00000200| 63 28 29 2e 0a 54 68 61 | 6e 6b 73 20 66 6f 72 20 |c()..Tha|nks for |
|00000210| 61 20 77 6f 6e 64 65 72 | 66 75 6c 20 63 6f 6d 70 |a wonder|ful comp|
|00000220| 2e 6c 61 6e 67 2e 63 20 | 6e 65 77 73 67 72 6f 75 |.lang.c |newsgrou|
|00000230| 70 2e 20 54 68 65 20 72 | 65 70 6c 79 73 20 61 72 |p. The r|eplys ar|
|00000240| 65 20 76 65 72 79 0a 68 | 65 6c 70 66 75 6c 2e 20 |e very.h|elpful. |
|00000250| 57 69 74 68 20 74 68 65 | 73 65 20 68 65 6c 70 2c |With the|se help,|
|00000260| 20 49 20 61 6d 20 61 62 | 6c 65 20 74 6f 20 64 65 | I am ab|le to de|
|00000270| 74 65 63 74 20 74 68 65 | 20 62 75 67 20 69 6e 20 |tect the| bug in |
|00000280| 6d 79 20 70 72 6f 67 72 | 61 6d 0a 77 68 69 63 68 |my progr|am.which|
|00000290| 20 68 61 73 20 62 65 65 | 6e 20 62 75 67 67 69 6e | has bee|n buggin|
|000002a0| 67 20 66 6f 72 20 73 65 | 76 65 72 61 6c 20 64 61 |g for se|veral da|
|000002b0| 79 73 2e 20 41 73 20 61 | 6e 20 61 70 70 72 65 63 |ys. As a|n apprec|
|000002c0| 69 61 74 69 6f 6e 2c 20 | 49 20 63 6f 6d 70 69 6c |iation, |I compil|
|000002d0| 65 64 0a 74 68 65 20 72 | 65 70 6c 69 65 73 20 49 |ed.the r|eplies I|
|000002e0| 20 67 6f 74 20 61 6e 64 | 20 70 6f 73 74 20 74 68 | got and| post th|
|000002f0| 65 6d 20 62 61 63 6b 20 | 61 6e 64 20 68 6f 70 65 |em back |and hope|
|00000300| 20 6f 74 68 65 72 20 70 | 65 6f 70 6c 65 20 63 61 | other p|eople ca|
|00000310| 6e 20 62 65 6e 65 66 69 | 74 0a 66 72 6f 6d 20 74 |n benefi|t.from t|
|00000320| 68 65 73 65 20 72 65 70 | 6c 69 65 73 2e 20 0a 0a |hese rep|lies. ..|
|00000330| 20 20 20 20 42 65 66 6f | 72 65 20 49 20 67 6f 20 | Befo|re I go |
|00000340| 6f 6e 2c 20 49 27 64 20 | 6c 69 6b 65 20 74 6f 20 |on, I'd |like to |
|00000350| 61 64 76 6f 63 61 74 65 | 20 74 68 65 20 75 73 65 |advocate| the use|
|00000360| 20 6f 66 20 45 6c 65 63 | 74 72 69 63 46 65 6e 63 | of Elec|tricFenc|
|00000370| 65 20 74 6f 0a 64 65 62 | 75 67 20 70 72 6f 62 6c |e to.deb|ug probl|
|00000380| 65 6d 73 20 72 65 6c 61 | 74 65 64 20 74 6f 20 6d |ems rela|ted to m|
|00000390| 61 6c 6c 6f 63 28 29 2c | 20 63 61 6c 6c 6f 63 28 |alloc(),| calloc(|
|000003a0| 29 2c 20 61 6e 64 20 66 | 72 65 65 28 29 20 65 74 |), and f|ree() et|
|000003b0| 63 2e 20 49 20 67 6f 74 | 20 74 68 69 73 0a 61 64 |c. I got| this.ad|
|000003c0| 76 69 63 65 20 66 72 6f | 6d 20 63 32 61 31 39 32 |vice fro|m c2a192|
|000003d0| 40 75 67 72 61 64 2e 63 | 73 2e 75 62 63 2e 63 61 |@ugrad.c|s.ubc.ca|
|000003e0| 2e 20 49 20 63 6f 6d 70 | 69 6c 65 64 20 69 74 20 |. I comp|iled it |
|000003f0| 61 6e 64 20 69 74 20 68 | 65 6c 70 65 64 20 6d 65 |and it h|elped me|
|00000400| 20 66 69 6e 64 0a 74 68 | 65 20 62 75 67 20 71 75 | find.th|e bug qu|
|00000410| 69 63 6b 6c 79 20 74 6f | 67 65 74 68 65 72 20 77 |ickly to|gether w|
|00000420| 69 74 68 20 73 6f 6d 65 | 20 6b 6e 6f 77 6c 65 64 |ith some| knowled|
|00000430| 67 65 73 20 49 20 6c 65 | 61 72 6e 65 64 20 66 72 |ges I le|arned fr|
|00000440| 6f 6d 20 6f 74 68 65 72 | 0a 72 65 70 6c 69 65 73 |om other|.replies|
|00000450| 2e 20 59 6f 75 20 63 61 | 6e 20 61 63 71 75 69 72 |. You ca|n acquir|
|00000460| 65 20 74 68 65 20 45 6c | 65 63 74 72 69 63 46 65 |e the El|ectricFe|
|00000470| 6e 63 65 20 61 74 0a 66 | 74 70 3a 2f 2f 66 74 70 |nce at.f|tp://ftp|
|00000480| 2e 73 74 2e 6e 65 70 65 | 61 6e 2e 75 77 73 2e 65 |.st.nepe|an.uws.e|
|00000490| 64 75 2e 61 75 2f 75 6e | 69 78 2f 6c 69 6e 75 78 |du.au/un|ix/linux|
|000004a0| 2f 20 6f 72 20 66 74 70 | 3a 2f 2f 75 6e 69 78 2e |/ or ftp|://unix.|
|000004b0| 68 65 6e 73 61 2e 61 63 | 2e 75 6b 2f 6d 69 72 72 |hensa.ac|.uk/mirr|
|000004c0| 6f 72 73 2f 79 67 67 64 | 72 61 73 69 6c 2e 66 61 |ors/yggd|rasil.fa|
|000004d0| 6c 6c 39 35 2f 64 69 73 | 6b 31 2f 75 73 72 2f 6c |ll95/dis|k1/usr/l|
|000004e0| 69 62 2f 79 67 67 64 72 | 61 73 69 6c 2f 63 6f 6d |ib/yggdr|asil/com|
|000004f0| 70 6f 6e 65 6e 74 73 2f | 2e 0a 4f 74 68 65 72 20 |ponents/|..Other |
|00000500| 66 74 70 20 73 69 74 65 | 73 20 63 61 6e 20 62 65 |ftp site|s can be|
|00000510| 20 66 6f 75 6e 64 20 62 | 79 20 75 73 69 6e 67 20 | found b|y using |
|00000520| 61 72 63 68 69 65 2e 0a | 0a 20 20 20 20 42 65 73 |archie..|. Bes|
|00000530| 74 20 72 65 67 61 72 64 | 73 20 74 6f 20 63 6f 6d |t regard|s to com|
|00000540| 70 2e 6c 61 6e 67 2e 63 | 21 20 48 6f 70 65 20 79 |p.lang.c|! Hope y|
|00000550| 6f 75 20 77 69 6c 6c 20 | 65 6e 6a 6f 79 20 79 6f |ou will |enjoy yo|
|00000560| 75 72 20 72 65 61 64 69 | 6e 67 20 74 68 65 0a 66 |ur readi|ng the.f|
|00000570| 6f 6c 6c 6f 77 69 6e 67 | 20 72 65 70 6c 69 65 73 |ollowing| replies|
|00000580| 2e 0a 0a 0a 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |....----|--------|
|00000590| 2d 2d 2d 2d 2d 20 61 6c | 6c 20 74 68 65 20 66 6f |----- al|l the fo|
|000005a0| 6c 6c 6f 77 69 6e 67 20 | 6d 65 73 73 61 67 65 73 |llowing |messages|
|000005b0| 20 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d | -------|--------|
|000005c0| 2d 2d 2d 2d 2d 2d 2d 2d | 0a 2d 2d 2d 2d 2d 2d 2d |--------|.-------|
|000005d0| 2d 2d 2d 61 72 65 20 62 | 65 6c 6f 6e 67 20 74 6f |---are b|elong to|
|000005e0| 20 74 68 65 20 69 6e 64 | 69 76 69 64 75 61 6c 20 | the ind|ividual |
|000005f0| 61 75 74 68 6f 72 73 20 | 6e 6f 74 20 6d 65 20 2d |authors |not me -|
|00000600| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 0a 0a 0a |--------|-----...|
|00000610| 0a 0a 46 72 6f 6d 20 61 | 33 37 38 67 72 61 69 40 |..From a|378grai@|
|00000620| 63 64 66 2e 74 6f 72 6f | 6e 74 6f 2e 65 64 75 57 |cdf.toro|nto.eduW|
|00000630| 65 64 20 46 65 62 20 32 | 38 20 30 39 3a 34 35 3a |ed Feb 2|8 09:45:|
|00000640| 30 30 20 31 39 39 36 0a | 44 61 74 65 3a 20 54 75 |00 1996.|Date: Tu|
|00000650| 65 2c 20 32 37 20 46 65 | 62 20 31 39 39 36 20 31 |e, 27 Fe|b 1996 1|
|00000660| 37 3a 33 33 3a 33 30 20 | 2d 30 35 30 30 0a 46 72 |7:33:30 |-0500.Fr|
|00000670| 6f 6d 3a 20 44 61 72 72 | 65 6c 6c 20 47 72 61 69 |om: Darr|ell Grai|
|00000680| 6e 67 65 72 20 3c 61 33 | 37 38 67 72 61 69 40 63 |nger <a3|78grai@c|
|00000690| 64 66 2e 74 6f 72 6f 6e | 74 6f 2e 65 64 75 3e 0a |df.toron|to.edu>.|
|000006a0| 54 6f 3a 20 43 68 65 6e | 79 61 6e 67 20 58 75 20 |To: Chen|yang Xu |
|000006b0| 3c 63 68 65 6e 79 61 6e | 67 40 6d 61 73 68 69 65 |<chenyan|g@mashie|
|000006c0| 2e 65 63 65 2e 6a 68 75 | 2e 65 64 75 3e 0a 53 75 |.ece.jhu|.edu>.Su|
|000006d0| 62 6a 65 63 74 3a 20 52 | 65 3a 20 6d 61 6c 6c 6f |bject: R|e: mallo|
|000006e0| 63 28 29 20 70 72 6f 62 | 6c 65 6d 20 0a 0a 4f 6e |c() prob|lem ..On|
|000006f0| 20 54 75 65 2c 20 32 37 | 20 46 65 62 20 31 39 39 | Tue, 27| Feb 199|
|00000700| 36 2c 20 43 68 65 6e 79 | 61 6e 67 20 58 75 20 77 |6, Cheny|ang Xu w|
|00000710| 72 6f 74 65 3a 0a 0a 3e | 20 20 20 20 20 52 65 63 |rote:..>| Rec|
|00000720| 65 6e 74 6c 79 20 49 20 | 68 61 76 65 20 62 65 65 |ently I |have bee|
|00000730| 6e 20 68 61 75 6e 74 65 | 64 20 62 79 20 74 68 65 |n haunte|d by the|
|00000740| 20 63 6f 72 65 20 64 75 | 6d 70 20 69 6e 73 69 64 | core du|mp insid|
|00000750| 65 20 6d 61 6c 6c 6f 63 | 28 29 20 6f 6e 20 53 47 |e malloc|() on SG|
|00000760| 49 0a 3e 20 49 6e 64 69 | 67 6f 32 20 49 52 49 58 |I.> Indi|go2 IRIX|
|00000770| 35 2e 32 2c 20 49 20 6b | 6e 6f 77 20 74 68 65 20 |5.2, I k|now the |
|00000780| 70 72 6f 62 6c 65 6d 20 | 69 73 20 63 61 75 73 65 |problem |is cause|
|00000790| 64 20 62 79 20 6d 79 20 | 70 72 6f 67 72 61 6d 20 |d by my |program |
|000007a0| 6e 6f 74 20 74 68 65 0a | 3e 20 6d 61 6c 6c 6f 63 |not the.|> malloc|
|000007b0| 28 29 2e 20 42 75 74 20 | 49 20 63 6f 75 6c 64 6e |(). But |I couldn|
|000007c0| 27 74 20 66 69 6e 64 20 | 74 68 65 20 62 75 67 3f |'t find |the bug?|
|000007d0| 20 44 6f 65 73 20 61 6e | 79 20 43 20 65 78 70 65 | Does an|y C expe|
|000007e0| 72 74 20 68 61 73 20 69 | 64 65 6e 74 69 66 69 65 |rt has i|dentifie|
|000007f0| 64 20 0a 3e 20 74 68 65 | 20 63 6f 6d 6d 6f 6e 20 |d .> the| common |
|00000800| 72 65 61 73 6f 6e 73 20 | 66 6f 72 20 6d 61 6c 6c |reasons |for mall|
|00000810| 6f 63 20 74 6f 20 63 6f | 72 65 20 64 75 6d 70 3f |oc to co|re dump?|
|00000820| 20 59 6f 75 72 20 68 65 | 6c 70 20 77 69 6c 6c 20 | Your he|lp will |
|00000830| 70 72 6f 62 61 62 6c 79 | 20 68 65 6c 70 0a 3e 20 |probably| help.> |
|00000840| 6d 65 20 74 6f 20 66 69 | 6e 64 20 74 68 65 20 20 |me to fi|nd the |
|00000850| 62 75 67 2e 20 54 68 61 | 6e 6b 20 79 6f 75 20 76 |bug. Tha|nk you v|
|00000860| 65 72 79 20 6d 75 63 68 | 21 0a 0a 4c 6f 6f 6b 20 |ery much|!..Look |
|00000870| 61 74 20 74 68 65 20 63 | 6f 64 65 20 61 62 6f 76 |at the c|ode abov|
|00000880| 65 20 74 68 65 20 6d 61 | 6c 6c 6f 63 20 77 68 69 |e the ma|lloc whi|
|00000890| 63 68 20 69 73 20 65 69 | 74 68 65 72 20 61 20 73 |ch is ei|ther a s|
|000008a0| 63 61 6e 66 20 6f 72 20 | 61 6e 79 0a 2a 70 6f 69 |canf or |any.*poi|
|000008b0| 6e 74 65 72 0a 72 65 66 | 65 72 65 6e 63 65 73 2e |nter.ref|erences.|
|000008c0| 20 49 66 20 79 6f 75 20 | 66 61 69 6c 65 64 20 74 | If you |failed t|
|000008d0| 6f 20 69 6e 63 6c 75 64 | 65 20 74 68 65 20 26 20 |o includ|e the & |
|000008e0| 6f 6e 20 61 20 76 61 72 | 69 61 62 6c 65 20 70 61 |on a var|iable pa|
|000008f0| 73 73 65 64 20 74 6f 20 | 73 63 61 6e 66 0a 79 6f |ssed to |scanf.yo|
|00000900| 75 20 63 6f 75 6c 64 20 | 63 6f 72 72 75 70 74 20 |u could |corrupt |
|00000910| 6d 61 6c 6c 6f 63 2e 20 | 49 66 20 79 6f 75 20 69 |malloc. |If you i|
|00000920| 6e 63 6c 75 64 65 64 20 | 61 20 26 20 6f 6e 20 74 |ncluded |a & on t|
|00000930| 68 65 20 6e 61 6d 65 20 | 6f 66 20 61 6e 20 61 72 |he name |of an ar|
|00000940| 72 61 79 0a 79 6f 75 0a | 63 6f 75 6c 64 20 68 61 |ray.you.|could ha|
|00000950| 76 65 20 63 6f 72 72 75 | 70 74 65 64 20 6d 61 6c |ve corru|pted mal|
|00000960| 6c 6f 63 2e 20 57 69 74 | 68 20 70 6f 69 6e 74 65 |loc. Wit|h pointe|
|00000970| 72 73 20 79 6f 75 20 63 | 6f 75 6c 64 20 63 6f 72 |rs you c|ould cor|
|00000980| 72 75 70 74 20 6d 61 6c | 6c 6f 63 20 62 79 0a 77 |rupt mal|loc by.w|
|00000990| 72 69 74 69 6e 67 20 74 | 6f 20 61 20 70 6f 69 6e |riting t|o a poin|
|000009a0| 74 65 72 20 69 6e 63 6f | 72 72 65 63 74 6c 79 2e |ter inco|rrectly.|
|000009b0| 20 4d 6f 73 74 20 69 6d | 70 6c 69 6d 65 6e 74 61 | Most im|plimenta|
|000009c0| 74 69 6f 6e 73 20 6f 66 | 20 6d 61 6c 6c 6f 63 20 |tions of| malloc |
|000009d0| 70 75 74 0a 73 6f 6d 65 | 0a 63 6f 64 65 20 69 6e |put.some|.code in|
|000009e0| 20 66 72 6f 6e 74 20 6f | 66 20 65 61 63 68 20 6d | front o|f each m|
|000009f0| 61 6c 6c 6f 63 20 63 61 | 6c 6c 20 73 6f 20 69 74 |alloc ca|ll so it|
|00000a00| 20 6b 6e 6f 77 73 20 68 | 6f 77 20 6d 75 63 68 20 | knows h|ow much |
|00000a10| 74 6f 20 66 72 65 65 20 | 6c 61 74 65 72 2e 20 49 |to free |later. I|
|00000a20| 66 0a 79 6f 75 20 64 69 | 64 20 73 6f 6d 65 74 68 |f.you di|d someth|
|00000a30| 69 6e 67 20 6c 69 6b 65 | 3a 0a 0a 20 20 20 20 20 |ing like|:.. |
|00000a40| 20 20 20 2a 70 2d 2d 0a | 6f 72 0a 20 20 20 20 20 | *p--.|or. |
|00000a50| 20 20 20 70 5b 2d 31 5d | 0a 0a 74 68 65 6e 20 79 | p[-1]|..then y|
|00000a60| 6f 75 20 63 6f 75 6c 64 | 20 62 65 20 63 6f 72 72 |ou could| be corr|
|00000a70| 75 70 74 69 6e 67 20 74 | 68 61 74 20 69 6e 66 6f |upting t|hat info|
|00000a80| 72 6d 61 74 69 6f 6e 2e | 20 46 72 65 65 20 74 68 |rmation.| Free th|
|00000a90| 69 73 20 62 6c 6f 63 6b | 20 61 6e 64 0a 6d 61 6c |is block| and.mal|
|00000aa0| 6c 6f 63 0a 67 65 74 73 | 20 61 6c 6c 20 63 6f 6e |loc.gets| all con|
|00000ab0| 66 75 73 65 64 20 62 75 | 74 20 64 6f 65 73 20 6e |fused bu|t does n|
|00000ac0| 6f 74 20 64 69 65 20 72 | 69 67 68 74 20 61 77 61 |ot die r|ight awa|
|00000ad0| 79 2e 20 50 6f 73 73 69 | 62 6c 65 20 68 75 6e 64 |y. Possi|ble hund|
|00000ae0| 72 65 64 73 20 6f 66 0a | 6c 69 6e 65 73 0a 6c 61 |reds of.|lines.la|
|00000af0| 74 65 72 20 79 6f 75 20 | 74 72 79 20 74 6f 20 64 |ter you |try to d|
|00000b00| 6f 20 61 6e 79 74 68 69 | 6e 67 20 6d 61 6c 6c 6f |o anythi|ng mallo|
|00000b10| 63 20 61 6e 64 20 63 6f | 72 65 20 64 75 6d 70 2e |c and co|re dump.|
|00000b20| 0a 0a 42 61 73 69 63 61 | 6c 6c 79 2c 20 70 6f 69 |..Basica|lly, poi|
|00000b30| 6e 74 65 72 73 20 61 6e | 64 20 61 64 64 72 65 73 |nters an|d addres|
|00000b40| 73 65 73 20 28 74 68 65 | 20 75 6e 61 72 79 20 6f |ses (the| unary o|
|00000b50| 70 65 72 61 74 6f 72 73 | 20 2a 20 61 6e 64 20 26 |perators| * and &|
|00000b60| 29 20 61 72 65 20 74 68 | 65 0a 6d 61 69 6e 20 63 |) are th|e.main c|
|00000b70| 61 75 73 65 20 6f 66 20 | 63 6f 72 65 20 64 75 6d |ause of |core dum|
|00000b80| 70 73 2e 0a 0a 45 6d 61 | 69 6c 3a 20 64 61 72 72 |ps...Ema|il: darr|
|00000b90| 65 6c 6c 2e 67 72 61 69 | 6e 67 65 72 40 75 74 6f |ell.grai|nger@uto|
|00000ba0| 72 6f 6e 74 6f 2e 63 61 | 0a 0a 46 72 6f 6d 20 63 |ronto.ca|..From c|
|00000bb0| 32 61 31 39 32 40 75 67 | 72 61 64 2e 63 73 2e 75 |2a192@ug|rad.cs.u|
|00000bc0| 62 63 2e 63 61 57 65 64 | 20 46 65 62 20 32 38 20 |bc.caWed| Feb 28 |
|00000bd0| 30 39 3a 34 34 3a 30 39 | 20 31 39 39 36 0a 44 61 |09:44:09| 1996.Da|
|00000be0| 74 65 3a 20 54 75 65 2c | 20 32 37 20 46 65 62 20 |te: Tue,| 27 Feb |
|00000bf0| 31 39 39 36 20 31 35 3a | 33 35 3a 35 34 20 2d 30 |1996 15:|35:54 -0|
|00000c00| 38 30 30 0a 46 72 6f 6d | 3a 20 63 32 61 31 39 32 |800.From|: c2a192|
|00000c10| 40 75 67 72 61 64 2e 63 | 73 2e 75 62 63 2e 63 61 |@ugrad.c|s.ubc.ca|
|00000c20| 0a 43 63 3a 20 63 68 65 | 6e 79 61 6e 67 40 6d 61 |.Cc: che|nyang@ma|
|00000c30| 73 68 69 65 2e 65 63 65 | 2e 6a 68 75 2e 65 64 75 |shie.ece|.jhu.edu|
|00000c40| 0a 4e 65 77 73 67 72 6f | 75 70 73 3a 20 63 6f 6d |.Newsgro|ups: com|
|00000c50| 70 2e 6c 61 6e 67 2e 63 | 0a 53 75 62 6a 65 63 74 |p.lang.c|.Subject|
|00000c60| 3a 20 52 65 3a 20 6d 61 | 6c 6c 6f 63 28 29 20 70 |: Re: ma|lloc() p|
|00000c70| 72 6f 62 6c 65 6d 0a 0a | 49 6e 20 61 72 74 69 63 |roblem..|In artic|
|00000c80| 6c 65 20 3c 33 31 33 33 | 32 39 39 32 2e 34 31 43 |le <3133|2992.41C|
|00000c90| 36 40 6d 61 73 68 69 65 | 2e 65 63 65 2e 6a 68 75 |6@mashie|.ece.jhu|
|00000ca0| 2e 65 64 75 3e 2c 0a 43 | 68 65 6e 79 61 6e 67 20 |.edu>,.C|henyang |
|00000cb0| 58 75 20 20 3c 63 68 65 | 6e 79 61 6e 67 40 6d 61 |Xu <che|nyang@ma|
|00000cc0| 73 68 69 65 2e 65 63 65 | 2e 6a 68 75 2e 65 64 75 |shie.ece|.jhu.edu|
|00000cd0| 3e 20 77 72 6f 74 65 3a | 0a 3e 48 69 2c 20 74 68 |> wrote:|.>Hi, th|
|00000ce0| 65 72 65 2c 0a 3e 0a 3e | 20 20 20 20 52 65 63 65 |ere,.>.>| Rece|
|00000cf0| 6e 74 6c 79 20 49 20 68 | 61 76 65 20 62 65 65 6e |ntly I h|ave been|
|00000d00| 20 68 61 75 6e 74 65 64 | 20 62 79 20 74 68 65 20 | haunted| by the |
|00000d10| 63 6f 72 65 20 64 75 6d | 70 20 69 6e 73 69 64 65 |core dum|p inside|
|00000d20| 20 6d 61 6c 6c 6f 63 28 | 29 20 6f 6e 20 53 47 49 | malloc(|) on SGI|
|00000d30| 0a 3e 49 6e 64 69 67 6f | 32 20 49 52 49 58 35 2e |.>Indigo|2 IRIX5.|
|00000d40| 32 2c 20 49 20 6b 6e 6f | 77 20 74 68 65 20 70 72 |2, I kno|w the pr|
|00000d50| 6f 62 6c 65 6d 20 69 73 | 20 63 61 75 73 65 64 20 |oblem is| caused |
|00000d60| 62 79 20 6d 79 20 70 72 | 6f 67 72 61 6d 20 6e 6f |by my pr|ogram no|
|00000d70| 74 20 74 68 65 0a 3e 6d | 61 6c 6c 6f 63 28 29 2e |t the.>m|alloc().|
|00000d80| 20 42 75 74 20 49 20 63 | 6f 75 6c 64 6e 27 74 20 | But I c|ouldn't |
|00000d90| 66 69 6e 64 20 74 68 65 | 20 62 75 67 3f 20 44 6f |find the| bug? Do|
|00000da0| 65 73 20 61 6e 79 20 43 | 20 65 78 70 65 72 74 20 |es any C| expert |
|00000db0| 68 61 73 20 69 64 65 6e | 74 69 66 69 65 64 20 0a |has iden|tified .|
|00000dc0| 3e 74 68 65 20 63 6f 6d | 6d 6f 6e 20 72 65 61 73 |>the com|mon reas|
|00000dd0| 6f 6e 73 20 66 6f 72 20 | 6d 61 6c 6c 6f 63 20 74 |ons for |malloc t|
|00000de0| 6f 20 63 6f 72 65 20 64 | 75 6d 70 3f 20 59 6f 75 |o core d|ump? You|
|00000df0| 72 20 68 65 6c 70 20 77 | 69 6c 6c 20 70 72 6f 62 |r help w|ill prob|
|00000e00| 61 62 6c 79 20 68 65 6c | 70 0a 3e 6d 65 20 74 6f |ably hel|p.>me to|
|00000e10| 20 66 69 6e 64 20 74 68 | 65 20 20 62 75 67 2e 20 | find th|e bug. |
|00000e20| 54 68 61 6e 6b 20 79 6f | 75 20 76 65 72 79 20 6d |Thank yo|u very m|
|00000e30| 75 63 68 21 0a 0a 55 73 | 65 20 61 20 4d 61 6c 6c |uch!..Us|e a Mall|
|00000e40| 6f 63 20 64 65 62 75 67 | 67 65 72 2e 20 54 72 79 |oc debug|ger. Try|
|00000e50| 20 45 6c 65 63 74 72 69 | 63 46 65 6e 63 65 2e 20 | Electri|cFence. |
|00000e60| 49 74 20 77 61 73 20 64 | 65 76 65 6c 6f 70 65 64 |It was d|eveloped|
|00000e70| 20 61 20 6e 75 6d 62 65 | 72 20 6f 66 0a 79 65 61 | a numbe|r of.yea|
|00000e80| 72 73 0a 61 67 6f 20 61 | 74 20 50 69 78 61 72 2e |rs.ago a|t Pixar.|
|00000e90| 20 49 74 20 77 6f 72 6b | 73 20 75 6e 64 65 72 20 | It work|s under |
|00000ea0| 61 6e 20 61 73 73 6f 72 | 74 6d 65 6e 74 20 6f 66 |an assor|tment of|
|00000eb0| 20 55 4e 49 58 20 6f 70 | 65 72 61 74 69 6e 67 20 | UNIX op|erating |
|00000ec0| 73 79 73 74 65 6d 73 2e | 0a 0a 49 74 20 77 6f 72 |systems.|..It wor|
|00000ed0| 6b 73 20 62 79 20 72 65 | 70 6c 61 63 69 6e 67 20 |ks by re|placing |
|00000ee0| 74 68 65 20 6d 61 6c 6c | 6f 63 28 29 20 72 6f 75 |the mall|oc() rou|
|00000ef0| 74 69 6e 65 73 20 77 69 | 74 68 20 69 74 73 20 6f |tines wi|th its o|
|00000f00| 77 6e 20 72 6f 75 74 69 | 6e 65 73 20 77 68 69 63 |wn routi|nes whic|
|00000f10| 68 0a 70 6c 61 63 65 0a | 70 72 6f 74 65 63 74 65 |h.place.|protecte|
|00000f20| 64 20 70 61 67 65 73 20 | 61 72 6f 75 6e 64 20 61 |d pages |around a|
|00000f30| 6c 6c 6f 63 61 74 69 6f | 6e 20 62 6c 6f 63 6b 73 |llocatio|n blocks|
|00000f40| 2e 20 57 68 65 6e 20 79 | 6f 75 72 20 70 72 6f 67 |. When y|our prog|
|00000f50| 72 61 6d 20 6f 76 65 72 | 72 75 6e 73 20 74 68 65 |ram over|runs the|
|00000f60| 0a 62 6f 75 6e 64 61 72 | 69 65 73 20 6f 66 20 61 |.boundar|ies of a|
|00000f70| 20 62 6c 6f 63 6b 2c 20 | 69 74 20 63 61 75 73 65 | block, |it cause|
|00000f80| 73 20 61 20 73 65 67 6d | 65 6e 74 61 74 69 6f 6e |s a segm|entation|
|00000f90| 20 76 69 6f 6c 61 74 69 | 6f 6e 20 69 6d 6d 65 64 | violati|on immed|
|00000fa0| 69 61 74 65 6c 79 2c 0a | 73 6f 20 79 6f 75 0a 6b |iately,.|so you.k|
|00000fb0| 6e 6f 77 20 77 68 65 72 | 65 20 74 68 65 20 5f 72 |now wher|e the _r|
|00000fc0| 65 61 6c 5f 20 65 72 72 | 6f 72 20 68 61 70 70 65 |eal_ err|or happe|
|00000fd0| 6e 73 2e 0a 0a 49 20 6c | 65 61 72 6e 65 64 20 61 |ns...I l|earned a|
|00000fe0| 62 6f 75 74 20 45 6c 65 | 63 74 72 69 63 46 65 6e |bout Ele|ctricFen|
|00000ff0| 63 65 20 6f 6e 65 20 6d | 6f 72 6e 69 6e 67 20 61 |ce one m|orning a|
|00001000| 74 20 36 3a 30 30 20 61 | 6d 20 61 66 74 65 72 20 |t 6:00 a|m after |
|00001010| 49 20 73 70 65 6e 74 20 | 74 68 65 0a 77 68 6f 6c |I spent |the.whol|
|00001020| 65 0a 6e 69 67 68 74 20 | 63 68 61 73 69 6e 67 20 |e.night |chasing |
|00001030| 61 20 70 6f 69 6e 74 65 | 72 20 62 75 67 2e 20 49 |a pointe|r bug. I|
|00001040| 20 75 6e 74 61 72 72 65 | 64 20 74 68 65 20 74 68 | untarre|d the th|
|00001050| 69 6e 67 2c 20 63 6f 6d | 70 69 6c 65 64 20 69 74 |ing, com|piled it|
|00001060| 2c 20 6c 69 6e 6b 65 64 | 0a 74 68 65 0a 22 6c 69 |, linked|.the."li|
|00001070| 62 65 66 65 6e 63 65 2e | 61 22 20 6c 69 62 72 61 |befence.|a" libra|
|00001080| 72 79 20 74 6f 20 6d 79 | 20 70 72 6f 67 72 61 6d |ry to my| program|
|00001090| 20 61 6e 64 20 66 6f 75 | 6e 64 20 74 68 65 20 62 | and fou|nd the b|
|000010a0| 75 67 20 69 6e 20 74 68 | 72 65 65 20 73 65 63 6f |ug in th|ree seco|
|000010b0| 6e 64 73 2e 0a 0a 57 68 | 65 6e 20 79 6f 75 72 20 |nds...Wh|en your |
|000010c0| 70 72 6f 67 72 61 6d 20 | 69 73 20 6c 69 6e 6b 65 |program |is linke|
|000010d0| 64 20 77 69 74 68 20 45 | 46 2c 20 79 6f 75 20 63 |d with E|F, you c|
|000010e0| 61 6e 20 63 6f 6e 74 72 | 6f 6c 20 74 68 72 6f 75 |an contr|ol throu|
|000010f0| 67 68 20 65 6e 76 69 72 | 6f 6e 6d 65 6e 74 0a 76 |gh envir|onment.v|
|00001100| 61 72 69 61 62 6c 65 73 | 20 77 68 65 74 68 65 72 |ariables| whether|
|00001110| 20 74 68 65 20 65 6e 64 | 73 20 6f 66 20 62 6c 6f | the end|s of blo|
|00001120| 63 6b 73 20 61 72 65 20 | 61 6c 69 67 6e 65 64 20 |cks are |aligned |
|00001130| 6f 6e 20 70 61 67 65 20 | 62 6f 75 6e 64 61 72 69 |on page |boundari|
|00001140| 65 73 20 6f 72 0a 74 68 | 65 0a 62 65 67 69 6e 6e |es or.th|e.beginn|
|00001150| 69 6e 67 73 2c 20 74 6f | 20 64 65 74 65 63 74 20 |ings, to| detect |
|00001160| 6f 76 65 72 72 75 6e 73 | 20 6f 72 20 75 6e 64 65 |overruns| or unde|
|00001170| 72 72 75 6e 73 20 70 72 | 65 63 69 73 65 6c 79 20 |rruns pr|ecisely |
|00001180| 28 63 61 6e 27 74 20 64 | 6f 20 62 6f 74 68 2c 0a |(can't d|o both,.|
|00001190| 6f 62 76 69 6f 75 73 6c | 79 29 2e 20 59 6f 75 20 |obviousl|y). You |
|000011a0| 63 61 6e 20 61 6c 73 6f | 20 61 72 72 61 6e 67 65 |can also| arrange|
|000011b0| 20 66 6f 72 20 61 6c 6c | 20 66 72 65 65 28 29 64 | for all| free()d|
|000011c0| 20 6d 65 6d 6f 72 79 20 | 74 6f 20 62 65 0a 70 72 | memory |to be.pr|
|000011d0| 6f 74 65 63 74 65 64 2d | 2d 2d 74 68 69 73 0a 63 |otected-|--this.c|
|000011e0| 61 6e 20 75 73 65 20 61 | 20 6c 6f 74 20 6f 66 20 |an use a| lot of |
|000011f0| 76 69 72 74 75 61 6c 20 | 6d 65 6d 6f 72 79 20 6f |virtual |memory o|
|00001200| 6e 20 79 6f 75 72 20 6d | 61 63 68 69 6e 65 21 0a |n your m|achine!.|
|00001210| 46 72 6f 6d 20 73 65 65 | 62 73 40 73 6f 6c 6f 6e |From see|bs@solon|
|00001220| 2e 63 6f 6d 57 65 64 20 | 46 65 62 20 32 38 20 30 |.comWed |Feb 28 0|
|00001230| 39 3a 34 34 3a 34 34 20 | 31 39 39 36 0a 44 61 74 |9:44:44 |1996.Dat|
|00001240| 65 3a 20 54 75 65 2c 20 | 32 37 20 46 65 62 20 31 |e: Tue, |27 Feb 1|
|00001250| 39 39 36 20 31 38 3a 31 | 31 3a 31 37 20 2d 30 36 |996 18:1|1:17 -06|
|00001260| 30 30 0a 46 72 6f 6d 3a | 20 50 65 74 65 72 20 53 |00.From:| Peter S|
|00001270| 65 65 62 61 63 68 20 3c | 73 65 65 62 73 40 73 6f |eebach <|seebs@so|
|00001280| 6c 6f 6e 2e 63 6f 6d 3e | 0a 54 6f 3a 20 63 68 65 |lon.com>|.To: che|
|00001290| 6e 79 61 6e 67 40 6a 68 | 75 2e 65 64 75 0a 53 75 |nyang@jh|u.edu.Su|
|000012a0| 62 6a 65 63 74 3a 20 6d | 61 6c 6c 6f 63 2e 2e 2e |bject: m|alloc...|
|000012b0| 0a 0a 4d 6f 73 74 20 6f | 66 74 65 6e 2c 20 69 74 |..Most o|ften, it|
|000012c0| 27 73 20 6f 76 65 72 77 | 72 69 74 69 6e 67 20 74 |'s overw|riting t|
|000012d0| 68 65 20 65 6e 64 20 6f | 66 20 61 20 6d 61 6c 6c |he end o|f a mall|
|000012e0| 6f 63 27 64 20 73 70 61 | 63 65 2c 20 6f 72 20 77 |oc'd spa|ce, or w|
|000012f0| 72 69 74 69 6e 67 0a 62 | 65 66 6f 72 65 20 74 68 |riting.b|efore th|
|00001300| 65 20 62 65 67 69 6e 6e | 69 6e 67 20 6f 66 20 69 |e beginn|ing of i|
|00001310| 74 2c 20 6f 72 20 66 72 | 65 65 69 6e 67 20 73 6f |t, or fr|eeing so|
|00001320| 6d 65 74 68 69 6e 67 20 | 79 6f 75 20 64 69 64 6e |mething |you didn|
|00001330| 27 74 20 6d 61 6c 6c 6f | 63 2e 0a 0a 44 6f 20 79 |'t mallo|c...Do y|
|00001340| 6f 75 20 75 73 65 20 70 | 75 74 65 6e 76 20 61 6e |ou use p|utenv an|
|00001350| 64 20 67 65 74 65 6e 76 | 20 6d 75 63 68 3f 0a 0a |d getenv| much?..|
|00001360| 2d 73 0a 46 72 6f 6d 20 | 67 6f 72 64 6f 6e 40 73 |-s.From |gordon@s|
|00001370| 6e 65 61 6b 79 2e 6c 65 | 72 63 74 72 2e 6f 72 67 |neaky.le|rctr.org|
|00001380| 57 65 64 20 46 65 62 20 | 32 38 20 30 39 3a 34 34 |Wed Feb |28 09:44|
|00001390| 3a 34 38 20 31 39 39 36 | 0a 44 61 74 65 3a 20 57 |:48 1996|.Date: W|
|000013a0| 65 64 2c 20 32 38 20 46 | 65 62 20 39 36 20 30 34 |ed, 28 F|eb 96 04|
|000013b0| 3a 33 34 20 43 53 54 0a | 46 72 6f 6d 3a 20 47 6f |:34 CST.|From: Go|
|000013c0| 72 64 6f 6e 20 42 75 72 | 64 69 74 74 20 3c 67 6f |rdon Bur|ditt <go|
|000013d0| 72 64 6f 6e 40 73 6e 65 | 61 6b 79 2e 6c 65 72 63 |rdon@sne|aky.lerc|
|000013e0| 74 72 2e 6f 72 67 3e 0a | 54 6f 3a 20 63 68 65 6e |tr.org>.|To: chen|
|000013f0| 79 61 6e 67 40 6d 61 73 | 68 69 65 2e 65 63 65 2e |yang@mas|hie.ece.|
|00001400| 6a 68 75 2e 65 64 75 0a | 4e 65 77 73 67 72 6f 75 |jhu.edu.|Newsgrou|
|00001410| 70 73 3a 20 63 6f 6d 70 | 2e 6c 61 6e 67 2e 63 0a |ps: comp|.lang.c.|
|00001420| 53 75 62 6a 65 63 74 3a | 20 52 65 3a 20 6d 61 6c |Subject:| Re: mal|
|00001430| 6c 6f 63 28 29 20 70 72 | 6f 62 6c 65 6d 0a 0a 3e |loc() pr|oblem..>|
|00001440| 20 20 20 20 52 65 63 65 | 6e 74 6c 79 20 49 20 68 | Rece|ntly I h|
|00001450| 61 76 65 20 62 65 65 6e | 20 68 61 75 6e 74 65 64 |ave been| haunted|
|00001460| 20 62 79 20 74 68 65 20 | 63 6f 72 65 20 64 75 6d | by the |core dum|
|00001470| 70 20 69 6e 73 69 64 65 | 20 6d 61 6c 6c 6f 63 28 |p inside| malloc(|
|00001480| 29 20 6f 6e 20 53 47 49 | 0a 3e 49 6e 64 69 67 6f |) on SGI|.>Indigo|
|00001490| 32 20 49 52 49 58 35 2e | 32 2c 20 49 20 6b 6e 6f |2 IRIX5.|2, I kno|
|000014a0| 77 20 74 68 65 20 70 72 | 6f 62 6c 65 6d 20 69 73 |w the pr|oblem is|
|000014b0| 20 63 61 75 73 65 64 20 | 62 79 20 6d 79 20 70 72 | caused |by my pr|
|000014c0| 6f 67 72 61 6d 20 6e 6f | 74 20 74 68 65 0a 3e 6d |ogram no|t the.>m|
|000014d0| 61 6c 6c 6f 63 28 29 2e | 20 42 75 74 20 49 20 63 |alloc().| But I c|
|000014e0| 6f 75 6c 64 6e 27 74 20 | 66 69 6e 64 20 74 68 65 |ouldn't |find the|
|000014f0| 20 62 75 67 3f 20 44 6f | 65 73 20 61 6e 79 20 43 | bug? Do|es any C|
|00001500| 20 65 78 70 65 72 74 20 | 68 61 73 20 69 64 65 6e | expert |has iden|
|00001510| 74 69 66 69 65 64 20 0a | 3e 74 68 65 20 63 6f 6d |tified .|>the com|
|00001520| 6d 6f 6e 20 72 65 61 73 | 6f 6e 73 20 66 6f 72 20 |mon reas|ons for |
|00001530| 6d 61 6c 6c 6f 63 20 74 | 6f 20 63 6f 72 65 20 64 |malloc t|o core d|
|00001540| 75 6d 70 3f 20 59 6f 75 | 72 20 68 65 6c 70 20 77 |ump? You|r help w|
|00001550| 69 6c 6c 20 70 72 6f 62 | 61 62 6c 79 20 68 65 6c |ill prob|ably hel|
|00001560| 70 0a 3e 6d 65 20 74 6f | 20 66 69 6e 64 20 74 68 |p.>me to| find th|
|00001570| 65 20 20 62 75 67 2e 20 | 54 68 61 6e 6b 20 79 6f |e bug. |Thank yo|
|00001580| 75 20 76 65 72 79 20 6d | 75 63 68 21 0a 0a 54 68 |u very m|uch!..Th|
|00001590| 65 20 63 6f 6d 6d 6f 6e | 20 72 65 61 73 6f 6e 73 |e common| reasons|
|000015a0| 20 66 6f 72 20 6d 61 6c | 6c 6f 63 28 29 20 74 6f | for mal|loc() to|
|000015b0| 20 64 75 6d 70 20 63 6f | 72 65 20 69 6e 63 6c 75 | dump co|re inclu|
|000015c0| 64 65 3a 0a 0a 2d 20 50 | 61 73 73 69 6e 67 20 62 |de:..- P|assing b|
|000015d0| 6f 67 75 73 20 70 6f 69 | 6e 74 65 72 73 20 28 6f |ogus poi|nters (o|
|000015e0| 6e 65 73 20 79 6f 75 20 | 64 69 64 6e 27 74 20 67 |nes you |didn't g|
|000015f0| 65 74 20 66 72 6f 6d 20 | 6d 61 6c 6c 6f 63 2c 20 |et from |malloc, |
|00001600| 61 64 64 72 65 73 73 65 | 73 0a 20 20 6f 66 20 61 |addresse|s. of a|
|00001610| 75 74 6f 20 76 61 72 69 | 61 62 6c 65 73 2c 20 6f |uto vari|ables, o|
|00001620| 72 20 61 6c 72 65 61 64 | 79 20 66 72 65 65 64 20 |r alread|y freed |
|00001630| 6d 65 6d 6f 72 79 29 20 | 74 6f 20 66 72 65 65 28 |memory) |to free(|
|00001640| 29 2e 20 20 0a 20 20 66 | 72 65 65 28 4e 55 4c 4c |). . f|ree(NULL|
|00001650| 29 20 69 73 20 6c 65 67 | 61 6c 2e 0a 2d 20 53 63 |) is leg|al..- Sc|
|00001660| 72 69 62 62 6c 69 6e 67 | 20 6f 6e 20 6d 6f 72 65 |ribbling| on more|
|00001670| 20 6d 65 6d 6f 72 79 20 | 74 68 61 6e 20 79 6f 75 | memory |than you|
|00001680| 20 61 6c 6c 6f 63 61 74 | 65 64 20 77 69 74 68 20 | allocat|ed with |
|00001690| 6d 61 6c 6c 6f 63 28 29 | 20 28 6f 66 66 20 74 68 |malloc()| (off th|
|000016a0| 65 0a 20 20 65 6e 64 2c | 20 6f 72 20 6f 66 66 20 |e. end,| or off |
|000016b0| 74 68 65 20 62 65 67 69 | 6e 6e 69 6e 67 29 2e 20 |the begi|nning). |
|000016c0| 20 6d 61 6c 6c 6f 63 28 | 73 74 72 6c 65 6e 28 73 | malloc(|strlen(s|
|000016d0| 29 29 2c 20 66 6f 6c 6c | 6f 77 65 64 20 62 79 20 |)), foll|owed by |
|000016e0| 63 6f 70 79 69 6e 67 0a | 20 20 73 20 69 6e 74 6f |copying.| s into|
|000016f0| 20 74 68 65 20 61 6c 6c | 6f 63 61 74 65 64 20 6d | the all|ocated m|
|00001700| 65 6d 6f 72 79 2c 20 69 | 73 20 61 20 73 75 72 65 |emory, i|s a sure|
|00001710| 20 73 69 67 6e 20 6f 66 | 20 74 68 69 73 2e 0a 2d | sign of| this..-|
|00001720| 20 53 63 72 69 62 62 6c | 69 6e 67 20 6f 6e 20 72 | Scribbl|ing on r|
|00001730| 61 6e 64 6f 6d 20 6d 65 | 6d 6f 72 79 20 74 68 72 |andom me|mory thr|
|00001740| 6f 75 67 68 20 75 6e 69 | 6e 69 74 69 61 6c 69 7a |ough uni|nitializ|
|00001750| 65 64 20 70 6f 69 6e 74 | 65 72 73 2e 0a 0a 20 20 |ed point|ers... |
|00001760| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001770| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001780| 20 20 20 20 20 20 47 6f | 72 64 6f 6e 20 4c 2e 20 | Go|rdon L. |
|00001790| 42 75 72 64 69 74 74 0a | 20 20 20 20 20 20 20 20 |Burditt.| |
|000017a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000017b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 73 | | s|
|000017c0| 6e 65 61 6b 79 2e 6c 65 | 72 63 74 72 2e 6f 72 67 |neaky.le|rctr.org|
|000017d0| 21 67 6f 72 64 6f 6e 0a | 0a 0a 2d 2d 20 0a 43 68 |!gordon.|..-- .Ch|
|000017e0| 65 6e 79 61 6e 67 0a 0a | 20 20 20 20 20 20 20 20 |enyang..| |
|000017f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001800| 20 20 20 20 20 20 5c 5c | 7c 2f 2f 0a 20 20 20 20 | \\||//. |
|00001810| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001820| 20 20 20 20 20 20 20 20 | 20 20 28 6f 20 6f 29 0a | | (o o).|
|00001830| 20 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d | -------|--------|
|00001840| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 6f 6f 4f 2d 28 |--------|---ooO-(|
|00001850| 5f 29 2d 4f 6f 6f 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |_)-Ooo--|--------|
|00001860| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001870| 2d 2d 2d 2d 2d 2d 2d 2d | 0a 20 20 20 28 6f 29 20 |--------|. (o) |
|00001880| 34 31 30 2d 35 31 36 2d | 36 38 31 39 20 20 20 20 |410-516-|6819 |
|00001890| 20 20 20 20 20 20 20 20 | 20 7c 20 20 20 46 61 78 | | | Fax|
|000018a0| 3a 34 31 30 2d 35 31 36 | 2d 35 35 36 36 0a 20 20 |:410-516|-5566. |
|000018b0| 20 63 68 65 6e 79 61 6e | 67 40 6a 68 75 2e 65 64 | chenyan|g@jhu.ed|
|000018c0| 75 20 20 20 20 20 20 20 | 20 20 20 20 20 20 7c 20 |u | | |
|000018d0| 20 20 68 74 74 70 3a 2f | 2f 69 61 63 6c 2e 65 63 | http:/|/iacl.ec|
|000018e0| 65 2e 6a 68 75 2e 65 64 | 75 2f 7e 63 68 65 6e 79 |e.jhu.ed|u/~cheny|
|000018f0| 61 6e 67 20 20 20 20 20 | 20 0a 20 20 20 20 20 20 |ang | . |
|00001900| 20 20 20 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f | _____|________|
|00001910| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00001920| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 5f 5f 5f 5f |________|________|
|00001930| 5f 5f 5f 5f 5f 5f 5f 5f | 5f 5f 5f 5f 0a 20 20 20 |________|____. |
|00001940| 20 20 20 20 20 2f 20 20 | 20 20 20 20 20 20 20 20 | / | |
|00001950| 49 6d 61 67 65 20 41 6e | 61 6c 79 73 69 73 20 61 |Image An|alysis a|
|00001960| 6e 64 20 43 6f 6d 6d 75 | 6e 69 63 61 74 69 6f 6e |nd Commu|nication|
|00001970| 20 4c 61 62 20 20 20 20 | 20 20 20 20 20 20 2f 0a | Lab | /.|
|00001980| 20 20 20 20 20 20 20 2f | 20 20 20 44 65 70 61 72 | /| Depar|
|00001990| 74 6d 65 6e 74 20 6f 66 | 20 74 68 65 20 20 45 6c |tment of| the El|
|000019a0| 65 63 74 72 69 63 20 61 | 6e 64 20 43 6f 6d 70 75 |ectric a|nd Compu|
|000019b0| 74 65 72 20 45 6e 67 69 | 6e 65 65 72 69 6e 67 20 |ter Engi|neering |
|000019c0| 2f 0a 20 20 20 20 20 20 | 2f 20 20 20 20 20 20 20 |/. |/ |
|000019d0| 20 20 54 68 65 20 4a 6f | 68 6e 73 20 48 6f 70 6b | The Jo|hns Hopk|
|000019e0| 69 6e 73 20 55 6e 69 76 | 65 72 73 69 74 79 20 20 |ins Univ|ersity |
|000019f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001a00| 20 2f 20 20 0a 20 20 20 | 20 20 2f 20 20 20 20 20 | / . | / |
|00001a10| 20 20 20 20 20 20 20 20 | 42 61 6c 74 69 6d 6f 72 | |Baltimor|
|00001a20| 65 2c 20 4d 44 20 32 31 | 32 31 38 20 20 20 20 20 |e, MD 21|218 |
|00001a30| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001a40| 20 20 20 2f 0a 20 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d | /. ==|========|
|00001a50| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00001a60| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00001a70| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00001a80| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 0a |========|=====. |
+--------+-------------------------+-------------------------+--------+--------+